import { DataTypes } from "sequelize";
import sequelize from "../db/index.js";

const answer = sequelize.define('answer', {
  answer_id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    allowNull: false,
    unique: true,
    autoIncrement: true
  },
  answer_detail: {
    type: DataTypes.TEXT,
    allowNull: false
  },
  good_reputation: {
    type: DataTypes.INTEGER,
    allowNull: true,
    defaultValue: 0
  },
  subordinate_question: {
    type: DataTypes.INTEGER,
    allowNull: false
  },
  answer_creator: {
    type: DataTypes.INTEGER,
    allowNull: false
  },
  create_time:{
    type: DataTypes.STRING(255),
    allowNull: false
  },
  is_useful: {
    type: DataTypes.INTEGER,
    allowNull: true,
    defaultValue: 2
  }
},{
  tableName: 'answer',
  timestamps: false
})

export default answer